#include<bits/stdc++.h>
using namespace std;
int tong[100005];
bool ans[100005];



int main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	int n;
	cin>>n;
	bool check=1;
	int r1=0,r2=0;
	for(int i=1;i<=n;i++){
		int tmp;
		cin>>tmp;
		tong[tmp]++;
		if(tmp>2)check=0;
		else if(tmp==1)r1++;
		else if(tmp==2)r2++;
	}
	if(check){
		if(r2>=r1)cout<<r2;
		else cout<<r1;
		return 0;
	}
	int oldpos=0,nowpos=0;
	for(int i=1;i<=100005;i++){
		if(tong[i]){
			oldpos=nowpos;nowpos=i;
			if(tong[nowpos]>=tong[oldpos])n-=tong[oldpos];
			else {
				n-=tong[nowpos];
				tong[nowpos]+=tong[oldpos]-tong[nowpos];
			}
		}
		
	}
	cout<<n;
	return 0;
	
}
